{include file="public/common" /}
<form class="layui-form" >

    <div class="layui-form-item">
        <label class="layui-form-label">复选框</label>
        <div class="layui-input-block">
            {volist name="$community" id="item"}
            <input type="checkbox" name="community[{$item.id}]" value="{$item.id}" title="{$item.community_name}"
               {if condition="$item->select_ == 1 "} checked {/if}
            >
            {/volist}
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script>
    layui.use(['form', 'layedit', 'laydate'], function ()
    {
        var form = layui.form()
                , layer = layui.layer
                , layedit = layui.layedit;
        //监听提交
        form.on('submit(formDemo)', function(data)
        {
            //layer.msg(JSON.stringify(data.field));
            $.ajax({
                url: "{:addon_url('seller://community/seller_community_edit')}",
                dataType: "json",
                async: true,
                data: data.field,
                type: "POST",
                success: function (res)
                {
                    if (res.code != 0)
                    {
                        layer.alert(res.data, {icon: 5});
                    }
                    else
                    {
                        layer.msg(res.data, {
                            icon: 1,
                            time: 2000
                        }, function(){
                        });
                    }
                }
            });
            return false;
        });

    });
</script>